<%@page import="com.mconnect.msurvey.controller.PlanManager"%>
<%@page import="com.mconnect.msurvey.model.SurveyPlan"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<%@page import="com.mconnect.msurvey.model.User"%>
<%@page import="java.util.Set"%>
<%@page import="java.util.HashSet"%>
<%@page import="com.mconnect.msurvey.controller.UserManager"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
         <%@ taglib prefix="s" uri="/struts-tags"%>
 <%
// w celu poprawnie dzialajacej sesji:
response.setHeader("Cache-Control","no-store"); 
response.setHeader("Pragma","no-cache"); 
response.setDateHeader ("Expires", 0); 
%>     
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Admin Panel</title>
<link rel="stylesheet" href="resources/css/ap.css">
<link rel="stylesheet" href="js/jQuery/demos.css">
<link rel="stylesheet" href="js/jQuery/themes/base/jquery.ui.all.css">
<link rel="stylesheet" type="text/css" href="resources/css/search_grid_style.css" />
<script src="js/jQuery/jquery-1.8.2.js"></script>
<script src="js/jQuery/ui/jquery.ui.core.js"></script>
<script src="js/jQuery/ui/jquery.ui.datepicker.js"></script>
<script src="js/jQuery/ui/jquery.ui.widget.js"></script>

<style>
		div#users-contain table { margin: 1em 0; border-collapse: collapse; width: 100%; }
		th#jaca { border: 1px solid #eee; padding: .6em 10px; text-align: left; text-align: center; height: 30px;}
		td#jaca { border: 1px solid #eee; padding: .2em 2px; text-align: left; text-align: center; height: 30px;}
		input{
			width: 130px;
		}
		input#brand{
			width: 20px;
		}
		td#label{
			width: 150px;
			margin-left: 10px;
			height: 30px;
			text-align: left;
		}
		td#cont{
			width: 150px;
		}
		

	</style>

<script type="text/javascript">
		$(function() {
			$('.ui-tabs-search .search-adv-button').click(function(){$('#search-adv-form').toggle();});
			$( "#datepicker1" ).datepicker();
			$( "#datepicker2" ).datepicker();
			$('#choosePlan').click(function(){
				var id_plan = $( "#id_plan" ).val();
				var firstname = $( "#s_firstname" ).val();
				var lastname = $( "#s_lastname" ).val();
				var pesel = $( "#s_pesel" ).val();
				var status = $( "#s_status" ).val();
				var phone = $( "#s_phone" ).val();
				var statusPesel = $( "#s_statusPesel" ).val();
				var dateFrom = $( "#datepicker1" ).val();
				var dateTo = $( "#datepicker2" ).val();
				var timeFrom = $( "#timeFrom" ).val();
				var timeTo = $( "#timeTo" ).val();
				$.get(
						'confirm/confirmListContent.jsp',
						{
							id_plan: id_plan, firstname: firstname, lastname: lastname, pesel : pesel,
							status: status, phone : phone, statusPesel : statusPesel, dateFrom : dateFrom, dateTo : dateTo, timeFrom : timeFrom, timeTo : timeTo
						},
						function (content) {
							$('#content').html(content);
							
							return false;
						}
					);
			});
		});
</script>
		
</head>
<body>
<div id="top">
     <div class="sessionUser">
    	<div id="logoMconnect">
    		<img src="resources/images/top_logo.gif" width="84" height="59" alt="image001"/>
    	</div>
    	<div id="mConnect_txt">
        	mConnect<br/>al. Jana Pawła II 41c<br/>31-864 Kraków
       </div>
    	
	     <% User admin = (User)session.getAttribute("admin"); 
			if(admin == null){ %>
				<jsp:forward page="loginAdminForm.jsp"></jsp:forward>
		<%}%>
    </div>
    <img src="resources/images/kreska.png" class="kreska">
    <div class="header_txt">
     <a href="adminPanel.jsp" style="text-decoration: none;">
     		<p class="header_txt_1">mSurvey</p>
      		<p class="header_txt_2">Panel Administratora</p>
      	</a>
    </div>
    <ul id=menu>
      
    <li><s:a action="goToSearchSurvey"> Wyszukaj ankietę </s:a></li>
	<li><s:a action="goToCampaigns">Kampanie</s:a></li>
	<li><s:a action="goToRegisterUser">Dodaj ankietera</s:a></li>
	<li><s:a action="goToConfirmList">+Potwierdziły przybycie+</s:a></li>
	<li><s:a action="goToReports">Raporty</s:a></li>
	<li style="float: right"><s:a action="logoutAdmin">Wyloguj</s:a></li>
    </ul>
    <div id=kategorie>
	<center>
				
			<div id="content1" style=" margin-top: 30px; margin-bottom: 30px;  font-size: 12px;">
			<% PlanManager pM = new PlanManager();
				List<SurveyPlan> planList = new ArrayList<SurveyPlan>();
				planList = pM.getPlanList();
			%>
			<div id="page" class="ui-tabs ui-widget" style="width: 850px;">
				<ul class="ui-tabs-nav ui-tabs-search">
					<li style="border: 0; width: 250px;  text-align: center;"><h3>Potwierdziły przybycie na rozmowę</h3></li>
					<li class="search-bottom">
						<span class="fll hint note request-time" style="margin-top: 9px;">Kampania</span>
						<a href="#" class="search-adv-button fll"><span class="ui-icon ui-icon-carat-1-s"></span></a>
						<select id="id_plan" name="id_plan"  style="float:left; margin-top: 7px; width:200px;">
						<option value="0">Wszystkie</option>
						<% for(SurveyPlan plan : planList){ %> 
									<option value="<%=plan.getId_plan() %>"><%= plan.getPlanName() %></option>
								<%} %>	
						</select>
						<a href="#" id="choosePlan" class="search-button fll"><span class="ui-icon ui-icon-search"></span></a>
					</li>
				</ul>
				<div class="clear"></div>
				<div id="search-adv-form" class="form search-form" style="display:none">
					<div class="wide">

						<table style="width: 810px;">
							<tr>
								<td style="width: 270px;">
									<label class="note" style="margin-top:3px;">Imie</label> 
									<input type="text"  id="s_firstname">
								</td>
								<td>
									<label class="note" style="margin-top:3px;">Nazwisko</label>
									<input type="text"  id="s_lastname">
								</td>
								<td>
									<label class="note" style="margin-top:3px;">Telefon</label>
									<input type="text"  id="s_phone">
								</td>
							</tr>
							<tr>
								<td>
									<label class="note" style="margin-top:3px;">Pesel</label>
									<input type="text" id="s_pesel">
								</td>
								<td>
									<label class="note" style="margin-top:3px;">Status</label>
									<select style="width: 135px;" id="s_status">
										<option value="all">Wszystkie</option>
										<option value="NIE">Nie sprawdzony</option>
										<option value="TAK">Sprawdzony</option>
									</select>
								</td>
								<td><label class="note" style="margin-top:3px;">Zapisano pesel</label>
									<select style="width: 135px;" id="s_statusPesel">
										<option value="all">Wszystkie</option>
										<option value="NIE">NIE</option>
										<option value="TAK">TAK</option>
									</select></td>
							</tr>
							<tr>
								
								<td colspan="2">
									<table style="margin-left : -4px;">
										<tr>
											<td><label class="note" style="margin-top:3px;">Data</label></td>
											<td><input type="text" id="datepicker1" ></td>
											<td>-</td>
											<td><input type="text" id="datepicker2" ></td>
										</tr>
									</table>
								</td>

								<td>
									<table style="margin-left : -4px;">
										<tr>
											<td><label class="note" style="margin-top:3px;">Godzina</label></td>
											<td><input type="text" id="timeFrom" style="width: 50px;"></td>
											<td>-</td>
											<td><input type="text" id="timeTo" style="width: 50px;"></td>
										</tr>
									</table>
									  
								</td>
							</tr>
							
						</table>
					</div>
				</div>
				<div class="clear"></div>
				<div class="search-label"></div>
				<div class="clear"></div>
				<div id="paging_container" class="container">
				<div id="reload" class="ui-overlay" style="display: none;"><div class="ui-widget-overlay"></div></div>
					
					<div class="clear"> </div>
					<div class="info_text hint note fll"> </div>
					<div class="page_navigation frr"> </div>
				</div>
				<div class="clear"></div>
			</div><!-- page -->
		</div>
		<div id="content">
				
		</div>
	</center>
	</div>
</div>		
</body>
</html>